package net.xi.news.service;

import net.xi.news.pojo.News;
import net.xi.news.pojo.NewsQuery;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.util.List;
import java.util.Map;

public interface NewsService {

    //根据id得到news
    News getNews(Long id);

    //根据id得到news，进行模糊查询
    Page<News> listNews(Pageable pageable, NewsQuery news);

    //分页，列出所有新闻
    Page<News> listNews(Pageable pageable);

    //列出前？新闻
    List<News> newsTop(Integer size);

    //根据标签列出新闻
    Page<News> listNewsByTag(Long tagId,Pageable pageable);

    //得到新闻详情内容
    News getConvert(Long id);

    //分页列出查询得到的新闻
    Page<News> listsearchNews(String query,Pageable pageable);

    //保存新闻
    News saveNews(News news);

    //更新新闻
    News updateNews(Long id,News news);

    //删除新闻
    void deleteNews(Long id);

    //根据月份进行分类，列出新闻
    Map<String,List<News>> holeNews();

    //统计新闻数量
    Long countNews();
}
